package cn.jsu.oj.dispatchServer.resource;

import cn.jsu.oj.dispatchServer.config.ResourceConfig;
import cn.jsu.oj.dispatchServer.dataStructure.MessageQueue;
import cn.jsu.oj.dispatchServer.handle.CommandPack;
import cn.jsu.oj.dispatchServer.pojo.AbstractPack;
import cn.jsu.oj.dispatchServer.pojo.TaskInfo;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author ahtonc
 */
public class Resource {
    /**
     * 任务大队列
     */
    public static MessageQueue<TaskInfo> taskBigQueue;

    /**
     * 暂存任务(已经发送但是没有返回结果)
     */
    public static Map<String , Map<Long, TaskInfo>> storeTaskMap;

    /**
     * 错误处理信息大队列
     */
    public static MessageQueue<CommandPack<AbstractPack>> errorQueue;

    public static final String JUDGE_PASSWORD;
    public static final String WEB_PASSWORD;
    public static final String WRITE_PASSWORD;

    static {
        JUDGE_PASSWORD = ResourceConfig.getConfigString("net.client.judge.connect.password");
        WEB_PASSWORD = ResourceConfig.getConfigString("net.client.web.connect.password");
        WRITE_PASSWORD = ResourceConfig.getConfigString("net.client.write.connect.password");
        taskBigQueue = new MessageQueue<>(100024);
        storeTaskMap = new ConcurrentHashMap<>();
        errorQueue = new MessageQueue<>(10000);
    }
}
